<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition template="/template.xhtml">
        <ui:define name="breadcrumbs">
            <h:form>
                <a href="index.xhtml">Website Admin</a><div class="breadcrumb_divider"></div>
                <h:commandLink action="#{registersController.prepareList()}" value="Registers" class="current"/>
            </h:form>
        </ui:define>
        <ui:define name="body">
            <h:form styleClass="jsfcrud_list_form" id="form">
                <h:panelGroup id="messagePanel" layout="block">
                    <h:messages errorClass="errorStyle" infoClass="infoStyle" layout="table" >
                    </h:messages>
                </h:panelGroup>

                <h:outputText escape="false" value="#{bundle.ListRegistersEmpty}" rendered="#{registersController.items.rowCount == 0}" class="infoStyle"> 
                </h:outputText>
                <article class="module width_full">
                    <header><h3>List of Register recounting</h3></header>
                    <div class="module_content">
                        <h:panelGroup rendered="#{registersController.items.rowCount > 0}">
                            <p:dataTable value="#{registersController.items}" var="item" paginator="true" rows="10" 
                                         paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
                                         rowsPerPageTemplate="5,10,15" style="width: 100%" styleClass="tablesorter" >
                                <p:column>
                                    <f:facet name="header">
                                        <h:outputText value="Id"/>
                                    </f:facet>
                                    <h:outputText value="#{item.reId}"/>
                                </p:column>
                                <p:column>
                                    <f:facet name="header">
                                        <h:outputText value="Create date"/>
                                    </f:facet>
                                    <h:outputText value="#{item.createDate}">
                                        <f:convertDateTime pattern="MM/dd/yyyy HH:mm:ss" />
                                    </h:outputText>
                                </p:column>
                                
                                <p:column>
                                    <f:facet name="header">
                                        <h:outputText value="Exam code"/>
                                    </f:facet>
                                    <h:outputText value="#{item.id.examId.examId}"/>
                                </p:column>
                                
                                <p:column>
                                    <f:facet name="header">
                                        <h:outputText value="Student name"/>
                                    </f:facet>
                                    <h:outputText value="#{item.id.studentId.stuName}"/>
                                </p:column>
                                
                                <p:column>
                                    <f:facet name="header">
                                        <h:outputText value="Roll No."/>
                                    </f:facet>
                                    <h:outputText value="#{item.id.studentId.enRoll}"/>
                                </p:column>
                                
                                <p:column>
                                    <f:facet name="header">
                                        <h:outputText value="Assign to"/>
                                    </f:facet>
                                    <h:outputText value="#{item.assignFac.firstName} #{item.assignFac.lastName}" rendered="#{item.assignFac != null}"/>
                                </p:column>
                                
                                <p:column>
                                    <f:facet name="header">
                                        <h:outputText value="&nbsp;"/>
                                    </f:facet>
                                    <h:commandLink action="#{registersController.prepareEdit}" value="Assign">            
                                        <f:setPropertyActionListener value="#{item}" target="#{registersController.selected}" />
                                    </h:commandLink>
                                </p:column>
                            </p:dataTable>
                        </h:panelGroup>
                        
                    </div></article>
            </h:form>
        </ui:define>
    </ui:composition>

</html>
